<template>
  <div class="content">
    <h2 class="title">热门精选</h2>
    <div class="list">
      <template v-for="(item, index) in houselist" :key="item.data.houseId">
        <home-item-v-9
          v-if="item.discoveryContentType === 9" 
          :ItemData="item.data"
          @click="itemClick(item.data)"
        />
        <home-item-v-3
          v-else-if="item.discoveryContentType === 3" 
          :ItemData="item.data"
          @click="itemClick(item.data)"
        />
      </template>
    </div>
  </div>
</template>

<script setup>
import HomeItemV3 from '@/components/homeItem/HomeItemV3.vue';
import HomeItemV9 from '@/components/homeItem/HomeItemV9.vue';
import homeStore from '@/stores/modules/home';
import { storeToRefs } from 'pinia';
import { useRouter } from 'vue-router';
const router=useRouter()

const usehomeStore=homeStore()
usehomeStore.fetchHouselistData()
const {houselist} =storeToRefs(usehomeStore)

// 跳转到详情页
function itemClick(args){
  // 跳转到detail页面r
     router.push('/detail/'+args.houseId)
     
}
</script>

<style lang="less" scoped>


.content {
  padding: 10px 8px;

  .title {
    font-size: 22px;
    padding: 10px;
  }

  .list {
    display: flex;
    flex-wrap: wrap;
  }
}
</style>